package com.twu.biblioteca;

/**
 * Created by twer on 7/10/14.
 */
public class Book {
    private int id;
    private String name;
    private String author;
    private int publishedYear;
    private boolean isAvailable;

    public Book(int id, String name, String author, int publishedYear){
        this.id = id;
        this.name = name;
        this.author = author;
        this.publishedYear = publishedYear;
        this.isAvailable = true;
    }

    public String getDetails() {
        return String.format("|%-4s|%-20s|%-13s|%-13s|",id, name, author, publishedYear);
    }

    public boolean isAvailable(){
        return isAvailable;
    }

    public void checkout() {
        isAvailable = false;
    }

    public void checkin() {
        isAvailable = true;
    }
}
